<template>
  <div class="app-container">
    <!-- 查询 -->
    <tl-list-search ref="search" :query-param="queryParam" @search="doQuery" v-if="isHeaderDisplay" :isDisplayDefaultSearch="false">
      <template slot="search">
        <el-form-item label="所属等级">
          <el-select v-model="queryParam.qry_sourcelevel" clearable>
            <el-option v-for="item in sourcelevelList" :key="item.code" :label="item.name" :value="parseInt(item.code)" />
          </el-select>
        </el-form-item>
        <el-form-item label="名称">
          <el-input v-model.trim="queryParam.qry_name" clearable placeholder="输入名称搜索" class="filter-item" @keyup.enter.native="doQuery" />
        </el-form-item>
      </template>
    </tl-list-search>
    <!-- 工具栏 -->
    <tl-list-toolbar ref="toolbar" @add="openAddDialog('editForm')" @exportExcel="doExportExcel" @deleteBatch="doDeleteBatch" @refresh="doRefresh" @columnCustomize="doColumnCustomize" @displaySearch="doDisplaySearch" :isDisplayDeleteBatch="selectedRowKeys.length > 0"> </tl-list-toolbar>
    <div>
      <!-- 列表选择 -->
      <div class="table-alert-div" ref="selector">
        <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
          <template slot="title">
            已选择&nbsp;<a class="tl-table-alert-info-a1">{{ selectedRowKeys.length }}</a
            >项&nbsp;&nbsp;
            <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
          </template>
        </el-alert>
      </div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" :height="tableHeight" resizable-key="tableHeight" :resizable-refs="['search', 'toolbar', 'selector', 'pager']" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="selection" width="55px"> </el-table-column>
        <el-table-column type="index" label="序号" width="55px" align="center"> </el-table-column>
        <!-- <el-table-column prop="dispsourcelevellist" min-width="150px" label="所属等级"></el-table-column> -->
        <el-table-column prop="name" min-width="150px" label="名称" sortable="custom" sort-by="name"></el-table-column>
        <el-table-column prop="dispstate" label="状态" min-width="150px" sortable="custom" sort-by="state"></el-table-column>
        <el-table-column prop="dispusercode" label="负责人" min-width="120px" sortable="custom" sort-by="usercode"></el-table-column>
        <el-table-column prop="telephone" label="联系电话" min-width="120px" sortable="custom" sort-by="telephone"></el-table-column>
        <el-table-column label="操作" width="220px" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button type="text" icon="el-icon-edit" @click="openEditDialog('editForm', scope.row.id)">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="doDelete(scope.row.id)">删除</el-button>
            <el-button type="text" icon="el-icon-view" @click="openViewDialog('editForm', scope.row.id)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
    </div>
    <tl-edit ref="editForm" @refresh="doRefresh"></tl-edit>
  </div>
</template>

<script>
// import checkPermission from '@/utils/permission' // 权限判断函数
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
import { putAction, getAction, postAction } from '@tapui/utils/http'
/** 子组件 */
import tlEdit from './edit'
export default {
  name: 'boardroomSource',
  components: { tlEdit },
  mixins: [mixin_list],
  data() {
    return {
      description: '这是会议室资源管理页面',
      url: {
        list: '/toa/boardroomSource/list',
        delete: '/toa/boardroomSource/delete',
        deleteBatch: '/toa/boardroomSource/deleteBatch',
        exportExcel: '/toa/boardroomSource/exportExcel', // 导出excel
        queryCodeList: '/toa/boardroomSource/dataCodeList'
      },
      sourcelevelList: []
    }
  },
  methods: {},
  created() {
    getAction(this.url.queryCodeList, {}).then(data => {
      this.sourcelevelList = data.result.sourcelevelList
    })
  }
}
</script>

<style scoped></style>
